Skip to content

drivers: video: CONFIG_VIDEO_SW_GENERATOR -> zephyr,video-sw-generator #88780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

josuah
Copy link
Collaborator

@josuah josuah commented Apr 18, 2025

Downstream:

Related:

As pointed out in the UVC PR, the typical way to configure hardware-like devices in Zephyr is via a chosen node. The other proposed approach for default video devices is #88182.

Because this is a purely virtual hardware, a snippet is provided to enable it in any example via --snippet video-sw-generator. Document its use in the 3 capture samples README.rst. The zephyr,camera doc was missing and is also added.

If this is indeed the way to go, I will convert these other PRs to use the devicetree instead of Kconfig:

@josuah
Copy link
Collaborator Author

josuah commented Apr 18, 2025

I picked video-sw-generator for the node label following #53506 and #83352.
Maybe zephyr_video_sw_generator is more appropriate...

@josuah josuah force-pushed the pr-video-sw-generator-dt branch from f62e2d4 to 8bd2a1d Compare April 18, 2025 01:48
loicpoulain
loicpoulain previously approved these changes Apr 18, 2025
Copy link
Collaborator

@loicpoulain loicpoulain left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but not tested.

Comment on lines 10 to 12
child-binding:
child-binding:
include: video-interfaces.yaml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add this because you don't have child node and use nothing from video-interfaces binding.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, no "sub-devices"... It is the "head" of the pipeline on its own.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems you forgot to remove these ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right thank you! I thought I needed to use it for the video_sw_pipeline but it ended-up not the case, I simply did not know how to best handle "m2m" devices. removed now!

@ngphibang
Copy link
Collaborator

ngphibang commented Apr 18, 2025

It's fine to me to turn video sw generator into devicetree so that #76798 can get merged because it's been there for a long time.

For a long-term solution, as discussed in #88182 and in #76798, I think

  • It's a bit weird that to be used as a camera, we have to convert all the SW emulated driver into devicetree, as naturally these devices are not HW and not need to be described via a devicetree.
  • zephyr,camera chosen node only specifies a unique device as camera while we should be able support multiple cameras (in the future): multiple HW camera sensors, or HW cameras and SW emulated devices and an ability to switch between them. So, we should expose multiple video devices to application.

But we can do that later as a future extension (as currently, we are all based on zephyr,camera) to not postpone #76798.

@josuah josuah force-pushed the pr-video-sw-generator-dt branch 2 times, most recently from ec0c215 to cb21eb8 Compare April 20, 2025 22:04
@josuah
Copy link
Collaborator Author

josuah commented Apr 20, 2025

force-push:

  • Fix CI YAML bug hidden by the auto-fallback behavior of VIDEO_SW_GENERATOR.

Thank you all for your patience!

@josuah josuah marked this pull request as ready for review April 20, 2025 22:51
@josuah josuah requested a review from ngphibang April 20, 2025 22:51
@josuah
Copy link
Collaborator Author

josuah commented May 19, 2025

Thanks for the review @avolmat-st! Though I just applied @JarmouniA diff saying include: base.yaml was not needed after all.

JarmouniA
JarmouniA previously approved these changes May 19, 2025
@josuah josuah force-pushed the pr-video-sw-generator-dt branch from e5127bc to 5dcb0e3 Compare May 19, 2025 23:17
@kartben kartben removed their assignment May 20, 2025
JarmouniA
JarmouniA previously approved these changes May 20, 2025
@josuah josuah requested a review from avolmat-st May 20, 2025 11:42
avolmat-st
avolmat-st previously approved these changes May 20, 2025
@josuah josuah dismissed stale reviews from avolmat-st and JarmouniA via f57f701 May 21, 2025 13:40
@josuah josuah force-pushed the pr-video-sw-generator-dt branch 2 times, most recently from f57f701 to 0aca1b4 Compare May 21, 2025 15:56
josuah added 6 commits May 22, 2025 10:24
By having an "auto-fallback" mechanism, the VIDEO_SW_GENERATOR did shadow
the fact that "platform:mimxrt1064_evk:SHIELD=dvp_fpc24_mt9m114" was
missing the full specification, and therefore was not matched at all:
the shield was not selected, but the CI still worked.

Signed-off-by: Josuah Demangeon <me@josuah.net>
Make the video software generator a devicetree node, which allows enabling
several instances, and select it as chosen { zephyr,camera = &... }; node.
It can be enabled via a `video-sw-generator` snippet.

Signed-off-by: Josuah Demangeon <me@josuah.net>
Convert the log module declarationto the new syntax introduced in
5e34681 proposing a more compact syntax.
This fixes the log level not being updated in the "capture" sample.

Signed-off-by: Josuah Demangeon <me@josuah.net>
Since this sample's headers are now grouped it is possible to sort them
alphabetically.

Signed-off-by: Josuah Demangeon <me@josuah.net>
Variables that holds pointers to 'const struct device' typically end-up
with '_dev'. The tcpserversink video sample did not have it. Add it.

Signed-off-by: Josuah Demangeon <me@josuah.net>
The zephyr,camera was used in several samples, but was not documented.
Add the missing documentation entry for it in the list.

Signed-off-by: Josuah Demangeon <me@josuah.net>
@josuah josuah force-pushed the pr-video-sw-generator-dt branch from 0aca1b4 to d845bd2 Compare May 22, 2025 10:42
@josuah
Copy link
Collaborator Author

josuah commented May 22, 2025

Force-push:

scrot_20250521_155645_732x119

One more review round to go... Thanks all for your patience!

Copy link

@kartben kartben merged commit cf6170c into zephyrproject-rtos:main Jun 2, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants